//
//  ShowTableViewController.m
//  VTableViewDemo
//
//  Created by marcus on 11-10-18.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import "ShowTableViewController.h"
#import "MyTableCell.h"
#import "DTGridView.h"
@implementation ShowTableViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [graidView setPagingEnabled:YES];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)dealloc
{
    [graidView release];
    [super dealloc];
}
#pragma mark DTGridViewDataSource Methods

- (NSInteger)numberOfRowsInGridView:(DTGridView *)gv {
	return 1;
}

- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gv forRowWithIndex:(NSInteger)index {
	return 20;
}

- (CGFloat)gridView:(DTGridView *)gv heightForRow:(NSInteger)rowIndex {
	return gv.frame.size.height;
}

- (CGFloat)gridView:(DTGridView *)gv widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
	return gv.frame.size.width;
}
- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
	MyTableCell *cell = (MyTableCell *)[gv dequeueReusableCellWithIdentifier:@"cell"];
	if (!cell) {
		cell = [[[NSBundle mainBundle] loadNibNamed:@"MyTableCell" owner:self options:nil] objectAtIndex:0];
		cell.identifier = @"cell";
	}
    [cell onShowCell];
	return cell;
}
@end
